:art: Support consigness relation

FFIB 5 年之前
父節點
當前提交
97513e9edd
共有 4 個文件被更改,包括 59 次插入1 次删除
  1. 28 0
      account/migrations/0002_auto_20200426_1624.py
  2. 9 1
      account/models.py
  3. 18 0
      pay/migrations/0002_auto_20200426_1624.py
  4. 4 0
      pay/views.py

+ 28 - 0
account/migrations/0002_auto_20200426_1624.py

@@ -0,0 +1,28 @@
1
+# Generated by Django 2.2.12 on 2020-04-26 08:24
2
+
3
+from django.db import migrations, models
4
+
5
+
6
+class Migration(migrations.Migration):
7
+
8
+    dependencies = [
9
+        ('account', '0001_initial'),
10
+    ]
11
+
12
+    operations = [
13
+        migrations.AddField(
14
+            model_name='userinfo',
15
+            name='consignee_address',
16
+            field=models.CharField(blank=True, help_text='收货人地址', max_length=255, null=True, verbose_name='consignee_address'),
17
+        ),
18
+        migrations.AddField(
19
+            model_name='userinfo',
20
+            name='consignee_name',
21
+            field=models.CharField(blank=True, help_text='收货人姓名', max_length=255, null=True, verbose_name='consignee_name'),
22
+        ),
23
+        migrations.AddField(
24
+            model_name='userinfo',
25
+            name='consignee_phone',
26
+            field=models.CharField(blank=True, help_text='收货人电话', max_length=255, null=True, verbose_name='consignee_phone'),
27
+        ),
28
+    ]

+ 9 - 1
account/models.py

@@ -20,6 +20,11 @@ class UserInfo(BaseModelMixin):
20 20
     province = models.CharField(_(u'province'), max_length=255, blank=True, null=True, help_text=u'用户省份')
21 21
     city = models.CharField(_(u'city'), max_length=255, blank=True, null=True, help_text=u'用户城市')
22 22
 
23
+    #收货信息
24
+    consignee_name = models.CharField(_(u'consignee_name'), max_length=255, blank=True, null=True, help_text=u'收货人姓名')
25
+    consignee_phone = models.CharField(_(u'consignee_phone'), max_length=255, blank=True, null=True, help_text=u'收货人电话')
26
+    consignee_address = models.CharField(_(u'consignee_address'), max_length=255, blank=True, null=True, help_text=u'收货人地址')
27
+
23 28
     class Meta:
24 29
         verbose_name = _('用户信息')
25 30
         verbose_name_plural = _('用户信息')
@@ -39,7 +44,10 @@ class UserInfo(BaseModelMixin):
39 44
             'country': self.country,
40 45
             'province': self.province,
41 46
             'city': self.city,
42
-            'user_id': self.user_id
47
+            'user_id': self.user_id,
48
+            'consignee_name': self.consignee_name,
49
+            'consignee_phone': self.consignee_phone,
50
+            'consignee_address': self.consignee_address,
43 51
         }
44 52
 
45 53
     @property

+ 18 - 0
pay/migrations/0002_auto_20200426_1624.py

@@ -0,0 +1,18 @@
1
+# Generated by Django 2.2.12 on 2020-04-26 08:24
2
+
3
+from django.db import migrations, models
4
+
5
+
6
+class Migration(migrations.Migration):
7
+
8
+    dependencies = [
9
+        ('pay', '0001_initial'),
10
+    ]
11
+
12
+    operations = [
13
+        migrations.AlterField(
14
+            model_name='orderinfo',
15
+            name='user_id',
16
+            field=models.CharField(blank=True, db_index=True, help_text='用户唯一标识', max_length=32, null=True, verbose_name='user_id'),
17
+        ),
18
+    ]

+ 4 - 0
pay/views.py

@@ -40,6 +40,10 @@ def wx_order_create_api(request):
40 40
     # 用户校验
41 41
     try:
42 42
         user = UserInfo.objects.get(user_id=user_id, status=True)
43
+        user.consignee_name = name
44
+        user.consignee_phone = phone
45
+        user.consignee_address = address
46
+        user.save()
43 47
     except UserInfo.DoesNotExist:
44 48
         return response(UserStatusCode.USER_NOT_FOUND)
45 49